import Taro from "@tarojs/taro";
import { baseURL } from "./baseURL";

export const request = (options) => {
  return new Promise((resolve, reject) => {
    const url = baseURL + options.url;
    Taro.request({
      header: {
        "content-type": "application/json", // 默认值
      },
      ...options,
      url,
      success: (res) => {
        resolve(res.data);
      },
      fail: (err) => {
        reject(err);
      },
    });
  });
};
